<h3>Product  Management</h3>
<fieldset>
<form>
<div>		
		<div style="display: inline;">      	
        	<?=form_dropdown("category",get_option("id","name","product_category"),@$_GET['category'],'','เลือกประเภทสินค้า');?>
        </div>
        <p></p>    	       
        <div style="display: inline">สถานะสินค้า
			<select name="status">
				<option value=""  <? if(@$_GET['status']=='')echo 'selected="selected"';?>>All</option>
				<option value="normal" <? if(@$_GET['status']=='normal')echo 'selected="selected"';?>>ไม่มีสถานะ</option>				
				<option value="p_hot"  <? if(@$_GET['status']=='hot_status')echo 'selected="selected"';?>>สินค้าขายดี</option>
				<option value="p_new"  <? if(@$_GET['status']=='new_status')echo 'selected="selected"';?>>สินค้าใหม่</option>
			</select>			
		</div>	
    	<p></p>	
	Search (Product Code/Model) : <input type="text" name="search" value="<?=@$_GET['search'];?>" size="60">
	<input type="submit" name="submit" value="Search">
	<? if(permission($menu_id, 'canadd')!=''){ ?> <div><a href="<?=$urlpage;?>/form">Add New</a></div><? } ?>
</div> 
</form>
</fieldset>


<div id="paging" class="pagination">
<?php echo 'Now have '.$num_rows.' Items';?>
<?php echo $pagination;?>
</div>
<form method="post" action="admin_product/multi_ordering?status=<?=@$_GET['status'];?>&scat_lv1=<?=@$_GET['scat_lv1'];?>&scat_lv2=<?=@$_GET['scat_lv2'];?>&scat_lv3=<?=@$_GET['scat_lv3'];?>&search=<?=@$_GET['search'];?>&page=<?=@$page;?>" >
<? if(permission($menu_id, 'canedit')!=''){ ?>	
<table>
<tr>
<td bgcolor="#F8F8F8" align="center" colspan="7">
<span class="Txt_gray2_12">Select Items:
<select name="item_action">
  <option value=""></option>
  <option value="up">Move Up</option>
  <option value="down">Move Down</option>
  <option value="top">Move To Top</option>
  <option value="bottom">Move To Last</option>
</select>
Step
<input type="text" size="5" id="step" name="step">
Move To Position 
<input type="text" size="5" id="target_position" name="target_position"> 
<input type="submit" value="Confirm" id="confirm" name="confirm">
</span></td>
</tr>
</table>
<? } ?>
<table class="tblist2">
<tr class="head">
	<th></th>
	<th></th>
	<th>ประเภท</th>
	<th>รหัสสินค้า</th>
	<th>ชื่อสินค้า</th>
	<th>ขนาด</th>	
	<th>ราคา:</th>	
	<th></th>
	<th></th>
	<th>Manage</th>
</tr>
<?php 
  $rowStyle = '';
  //$page = (isset($_GET['page']))? $_GET['page']:1;
  $i= (($page -1)* 12)+1;
  foreach($result as $row):	  
	 $redirect = $urlpage.'/form/'.$row['id'].$parameter;
?>  
<tr   <? if($rowStyle =='')$rowStyle = 'class="odd"';else $rowStyle = "";echo $rowStyle;?> >
  <td><input type="checkbox" name="select_product[]" value="<?=$row['id'];?>"></td>
  <td><?=$i;?></td>
  <td style="cursor: pointer;" align="left" onclick="window.location='<?=$redirect?>'">
  	<?
  	echo $row['cat_name'];
	?>
  </td>
  <td style="cursor: pointer;" align="left" onclick="window.location='<?=$redirect?>'"><?=$row['product_code'];?></td>
  <td style="cursor: pointer;" align="left" onclick="window.location='<?=$redirect?>'"><?=$row['name'];?></td>
  <td style="cursor: pointer;" align="left" onclick="window.location='<?=$redirect?>'"><?=$row['size'];?></td>  
  <td style="cursor: pointer;" align="right" onclick="window.location='<?=$redirect?>'"><?=number_format($row['price'],2);?> บาท / <?=$row['per_unit'];?></td>    
  <td align="center">
  	<? if(permission($menu_id, 'canedit')!=''){ ?>
  	<? if($row['show_no']<$max_no){?>
  	<a href="admin_product/ordering?status=<?=@$_GET['status'];?>&scat_lv1=<?=@$_GET['scat_lv1'];?>&scat_lv2=<?=@$_GET['scat_lv2'];?>&scat_lv3=<?=@$_GET['scat_lv3'];?>&search=<?=@$_GET['search'];?>&mode=up&id=<?=$row['id'];?>&page=<?=@$page;?>">
  	<img src="images/up.jpg">   
  	</a>
  	<? } ?>
  	<? } ?>
  </td>
  <td align="center">
  	<? if(permission($menu_id, 'canedit')!=''){ ?>
  	<? if($row['show_no']>$min_no){?>
  	<a href="admin_product/ordering?status=<?=@$_GET['status'];?>&scat_lv1=<?=@$_GET['scat_lv1'];?>&scat_lv2=<?=@$_GET['scat_lv2'];?>&scat_lv3=<?=@$_GET['scat_lv3'];?>&search=<?=@$_GET['search'];?>&mode=down&id=<?=$row['id'];?>&page=<?=@$page;?>">
  	<img src="images/down.jpg">
  	</a>
  	<? } ?>
  	<? } ?>
  </td>		  
  <td>  	
  	<? if(permission($menu_id, 'candelete')!=''){ ?>
  	<a href="<?=$urlpage;?>/delete/<?php echo $row['id']?><?=$parameter;?>" style="text-decoration:none;" onclick="return confirm('<?php echo NOTICE_CONFIRM_DELETE?>')"><input type="button" class="btn_delete" /></a>
  	<? } ?>  	
  </td>
  </tr>		
<? 
		$i++;
  		endforeach; 
?>		
</table>
</form>
	<div id="notify_container" style="display:none; margin-top: 80px;">		
		<div id="default">
			<div style="float:left;margin:0 10px 0 0"><img src="#{icon}" alt="warning" /></div>
			<h2>#{title}</h2>
			<p>#{text}</p>
		</div>		
	</div>	
